<?php
 # mtRand.php
function wp_generate_password($length ) {
  $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
  $password = '';
  for ( $i = 0; $i < $length; $i++ )
  $password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
  return $password;
}

echo wp_generate_password(8)."\n";
echo wp_generate_password(32)."\n";//Y5dbQ8s8xmslEj1LN5G3uW1rUNTuAHyj
?>